<template>
<div class="rightList">
        <!-- 面包屑 -->
    <el-breadcrumb separator-class="el-icon-caret-right">
      <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>权限列表</el-breadcrumb-item>
    </el-breadcrumb>
    <!-- 权限表格 -->
     <el-table :data="rightsList" style="width: 60%" border>
      <el-table-column type="index" width="50"></el-table-column>
      <el-table-column prop="authName" label="权限名称" width="180"></el-table-column>
      <el-table-column prop="path" label="路径" width="180"></el-table-column>
      <el-table-column prop="level" label="层次">
          <template slot-scope="scope">
              <span>{{scope.row.level | levelFrom}}</span>

          </template>
      </el-table-column>

    </el-table>
</div>
</template>
<script>
import { getAllrightsList } from '@/api/rights_index.js'
export default {
  data () {
    return {
      rightsList: []
    }
  },
  // filters是独立成员
  filters: {
    levelFrom (level) {
      if (level === '0') {
        return '一级'
      } else if (level === '1') {
        return '二级'
      } else if (level === '2') {
        return '三级'
      }
    }
  },
  mounted () {
    getAllrightsList('list')
      .then(res => {
        console.log(res)
        this.rightsList = res.data.data
      })
  }

}
</script>
<style lang='less' scoped>

</style>
